package Json;

import com.google.gson.Gson;
import com.google.gson.JsonSyntaxException;
import com.google.gson.annotations.SerializedName;

/**
 * @author Ajie
 * @date 8/31/21
 * @function beeboxes bug 测试
 */
public class JsonTest3 {
    static String str = "{\"flow_id\":\"a426efec0be044d1a1acbc008f51f23c\",\"url\":\"/API/record6666667777\",\"deviceSn\":\"111111\",\"jsonParam\":\"{\\\"taskAPIUrl\\\":\\\"/API/record6666667777\\\",\\\"details\\\":\\\"AAAA33\\\",\\\"personNo\\\":\\\"CCC\\\",\\\"deviceSn\\\":\\\"111111\\\",\\\"param1\\\":\\\"BBBB99B\\\",\\\"param2\\\":\\\"CCCCC8899\\\"}\"}";

    public static void main(String[] args) {
        APIRequestModel apiRequestModelFromBrowser = fromJson( str, APIRequestModel.class);
    }

    public static <T> T fromJson(String json, Class<T> clazz) throws JsonSyntaxException {
        return new Gson().fromJson(json, clazz);
    }


}
class APIRequestModel {

    @SerializedName("flow_id")
    private String flowId;

    @SerializedName("url")
    private String url;

    @SerializedName("deviceSn")
    private String deviceSn;

    @SerializedName("jsonParam")
    private String jsonParam;

    public String getFlowId() {
        return flowId;
    }

    public void setFlowId(String flowId) {
        this.flowId = flowId;
    }

    public String getUrl() {
        return url;
    }

    public void setUrl(String url) {
        this.url = url;
    }

    public String getDeviceSn() {
        return deviceSn;
    }

    public void setDeviceSn(String deviceSn) {
        this.deviceSn = deviceSn;
    }

    public String getJsonParam() {
        return jsonParam;
    }

    public void setJsonParam(String jsonParam) {
        this.jsonParam = jsonParam;
    }
}
